package
{
    import mx.controls.TextArea;
    
    public class Communication
    {
        
        private var srv:XMLSocket;
        private var chatbox:TextArea;
        
        
        public function Communication(url:String, port:int, chatbox:TextArea) {
            this.chatbox = chatbox;
            this.srv = new XMLSocket();
            this.srv.addEventListener(DataEvent.DATA, receiveMessage);
            this.srv.connect(url, port);
        }
        
        
        private function receiveMessage(e:DataEvent):void {
            this.chatbox.text += e.data + "\n";
        }
        
        
        public function sendMessage():void {
            srv.send('<message pseudo="hey" text="' + lblT.text + '" />');
        }
        
        
        public function sendCoord():void {
            
        }
    }
}